﻿using KWindow.KPageCore;
using LogLib;
using System;

namespace IPCPages
{
    public partial class PageNeedAttention : PageControlBase
    {      
        public PageNeedAttention()
        {
            InitializeComponent();
            SetProcessBase(ProcessNeedAttention.Instance);
        }

        //初始化窗体数据
        public override void InitCtrls()
        {
            base.InitCtrls();
            //SetButtonDefaultStyles(buttonBack);
            SetButtonDefaultStyles(buttonNext);
            SetButtonDefaultStyles(buttonCancel);
        }

        /// <summary>
        /// 初始化窗体数据
        /// </summary>
        public override void InitData()
        {
            base.InitData();
        }

        /// <summary>
        /// 保存窗体数据(窗体本次做完后, 进入下一步之前)
        /// </summary>
        public override void UpdateData()
        {
            base.UpdateData();
        }

        /// <summary>
        /// 清理窗体数据(窗体本次做完后)
        /// </summary>
        public override void ClearData()
        {
            base.ClearData();
       
        }

        /// <summary>
        /// 窗体关闭时
        /// </summary>
        public override void Close()
        {
            base.Close();
        }

        public override void StartWork()
        {
            base.StartWork();
        }    

        public override void StopWork()
        {
            base.StopWork();
        }

        public override void OnCountdownCompleted(object sender, EventArgs e)
        {
            if (Process.IsRunning)
            {
                StopWork();
                ClearData();
                Log.WriteAsync($"倒计时结束，自动跳转到下一页.");
                Process.ToNext();
            }
        }
    }
}
